home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
JCSM Shareware Collection 1993 November
/
JCSM Shareware Collection - 1993-11.iso
/
cl720
/
bxprntjj.lzh
/
TEST1.C
< prev
next >
Wrap
Text File
|
1990-11-30
|
2KB
|
84 lines
/* An integer MandelBrot set Program. */
/* Works with EGA and VGA. */
#include <stdio.h>
#include <graph.h>
#define not !
#define forever while (1)
#define MAX_ITERATIONS 30
#define MAX_BOUND 10000
typedef int coord;
typedef long dcoord;
typedef struct
{ coord x, y;
} point;
struct videoconfig vc;
point ScreenSize, Cursor, Centre, Scale;
float RealX, RealY, Mag;
int ScatX[640], ScatY[480];
int under[20];
char name[12] = { "\0" };
char buf[80];
long new_colors[16]= { 0x000000, 0x252A26, 0x37343F, 0x3F3F3F, 0x2E333F,
0x00003F, 0x00273F, 0x00363F, 0x003F3F, 0x003F26, 0x2A3F00, 0x3F271B,
0x3F0000, 0x3F002B, 0x350A35, 0x3F003F };
void DoPixel (int x, int y);
/* Colour in one pixel. */
boolean ClearScreen (void); /* Clear the Screen. */
/************ Initialisation routines *********************/
void assert (boolean c)
{
if (not c)
fprintf (stderr, "Error!\007");
}
void Swap (int *a, int *b)
{ register int c;
c = *a;
*a = *b;
*b = c;
}
void Init (void)
{ int i;
if (not ClearScreen ())
{
printf ("Not supported.");
exit (0);
}
_getvideoconfig (&vc);
ScreenSize.x = vc.numxpixels;
ScreenSize.y = vc.numypixels;
Mag = 1; /* Magnification */
Centre.x = ScreenSize.x / 2; /* Centre of screen */
Centre.y = ScreenSize.y / 2;
ScreenSize.y--;
/* We decrement this to obtain */
/* two relatively prime numbers*/
/* for the screen dimensions. */
/*------ Shuffle the Scat ('scatter') array. ------*/
for (i = 0; i < ScreenSize.x; i++)
ScatX[i] = i;
for (i = 0; i < ScreenSize.y; i++)
ScatY[i] = i;
for (i = 0; i < ScreenSize.x; i++)
Swap (&ScatX[i], &ScatX[rand () % ScreenSize.x]);
for (i = 0; i < ScreenSize.y; i++)
Swap (&ScatY[i], &ScatY[rand () % ScreenSize.y]);
LLATI